<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="css/style.css"/>       
        <link href="assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="assets/css/ace.min.css" />
        <link rel="stylesheet" href="Widget/zTree/css/metroStyle/metroStyle.css" type="text/css">
        <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
        
		<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
        <!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
			<script src="assets/js/jquery.min.js"></script>
		<!-- <![endif]-->
		<!--[if IE]>
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <![endif]-->
		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>
		<!-- <![endif]-->
		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
        <script src="assets/js/ace-elements.min.js"></script>
		<script src="assets/js/ace.min.js"></script>
        <script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>
        <script type="text/javascript" src="Widget/zTree/js/jquery.ztree.all-3.5.min.js"></script> 
        <script src="js/lrtk.js" type="text/javascript" ></script>
<title>分类管理</title>
</head>

<body>
<div class=" clearfix">
 <div id="category">
    <div id="scrollsidebar" class="left_Treeview">
    <div class="show_btn" id="rightArrow"><span></span></div>
    <div class="widget-box side_content" >
    <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
     <div class="side_list">
      <div class="widget-header header-color-green2">
          <h4 class="lighter smaller">产品类型列表</h4>
      </div>
      <div class="widget-body">
          <div class="widget-main padding-8">
              <div  id="treeDemo" class="ztree"></div>
          </div>
  </div>
  </div>
  </div>  
  </div>
<!---->
 <iframe ID="testIframe" Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO  SRC="product-category-add.html" class="page_right_style"></iframe>
 </div>
</div>
</body>
</html>
<script type="text/javascript"> 
$(function() { 
	$("#category").fix({
		float : 'left',
		//minStatue : true,
		skin : 'green',	
		durationTime :false
	});
});
</script>
<script type="text/javascript">
//初始化宽度、高度  
 $(".widget-box").height($(window).height()); 
 $(".page_right_style").width($(window).width()-220);
  //当文档窗口发生改变时 触发  
    $(window).resize(function(){
	$(".widget-box").height($(window).height());
	 $(".page_right_style").width($(window).width()-220);
	})
    //Ztree节点选取过后执行回调函数
   function doSetSelectNode(event, treeId, treeNode){
        $(".widget-box").data("data",treeNode);
        //在父窗口查询iframe子窗口
        var parentWindow=document.getElementById('testIframe').contentWindow;
        //把查询数据存入父窗口#form-user-add中
        parentWindow.$("#form-user-add").data("treeNode",treeNode);
        //为父窗口表单填充数据
        parentWindow.$("#name").val(treeNode.name);
        var orderId=treeNode.orderId;
        if(!orderId)orderId=0;
        parentWindow.$("#orderId").val(treeNode.orderId);
        parentWindow.$("#remark").val(treeNode.remark);
   }
   var zTree; //zTree是第三方扩展的一个Jquery插件
    	  //初始化zTree时会用到
   var setting = {
    	  	data : {
    	  		simpleData : {
    	  			enable : true,//表示使用简单数据模式
    	  			idKey : "id",  //节点数据中保存唯一标识的属性名称
    	  			pIdKey : "parentId",  //节点数据中保存其父节点唯一标识的属性名称
    	  			rootPId : null  //根节点id
    	  		}//json 格式javascript对象
    	  	},
           callback:{
        	   onClick:doSetSelectNode
           }
    	  }
   //页面加载后呈现数据
   function loadZtree(){
	   var url="product/productType/findObjects"
			 $.getJSON(url,function(result){
			  if(result.state==1){  
				  $(".type_style").data("data",result.data);
				  var zNodes =result.data;
				  //初始化Ztree数据
				  var t = $("#treeDemo");
				   zTree=$.fn.zTree.init(
							  t,
							  setting,
							  zNodes)
			  }
			  else alert(result.message);
			 })
   }
  $(document).ready(function(){
	 loadZtree();
	  });
</script>